package main

import (
	"fmt"
	"sort"
	"sync"
)
var gw sync.WaitGroup
func main() {

	ch := make(chan string)
	gw.Add(2)

	go func() {
		for m := range ch {
			fmt.Println("Processed:", m)
			//time.Sleep(1 * time.Second) // 模拟需要长时间运行的操作
			gw.Done()
		}
	}()

	ch <- "cmd.1"
	ch <- "cmd.2" // 不会被接收处理
	gw.Wait()
	fmt.Println("结束")
	a:=[]int{1,2,3,4}
	sort.Ints(a)
	fmt.Println(a)



}